# 获取kit Subsystem，owner中的全量数据
def getOwners(path):
    excel_path = r"/docs/zh-cn/contribute/docs-owners.md"
    result = {"Kit": {}, "Subsystem": {}, "gitcode_id": {}}
    # kit 列表
    kit_list = []
    kit_set = set
    # subsystem
    subsystem_list = []
    subsystem_set = set
    # 运行提交pr人员清单
    gitcode_id_list = set
    # 标准化路径
    normalized_path = os.path.normpath(path).replace('\\', '/')
    # print(normalized_path)
    # 分割路径为各个部分
    parts = normalized_path.split(os.sep)
    # 查找并截取到'docs'部分
    if '/docs/' in normalized_path:
        parts = normalized_path.split('/docs/')
        # 重新组合路径c
        new_part = parts[0] + excel_path
        # # 白名单标准化路径
        new_path = os.path.normpath(new_part)

        # if 'docs' in parts:
        # index = parts.index('docs')
        # new_parts = parts[:index + 1] + excel_path.split(os.sep)
        # # 重新组合路径
        # new_path = os.path.join(parts[0] + '\\', *new_parts[1:])
        # # 白名单标准化路径
        # new_path = os.path.normpath(new_path)
        if os.path.exists(new_path):
            with open(new_path, 'r', encoding='utf-8', errors='ignore') as mdfile:
                data = mdfile.read()
                pattern = r'\[.+?\]\[.+?\]'
                kit_sub_list = re.findall(pattern, data)
                for i in kit_sub_list:
                    list = i.split('][')
                    kit_list.append(list[0].replace('[', '').replace(']', ''))
                    subsystem_list.append(list[1].replace('[', '').replace(']', ''))

                pattern1 = r'@.*'
                id_list = re.findall(pattern1, data)
                for i in id_list:
                    i = i.strip()
                    gitcode_id_list.append(i)

        else:
            # 功能上线时的默认值，后续没有的需要自己添加
            kit_set = {'IME Kit', 'Crypto Architecture Kit', 'Common', 'ArkGraphics 2D', 'Calendar Kit', 'NDK',
                       'Ability Kit', 'ArkGraphics 3D', 'ArkTS', 'Location Kit', 'Camera Kit', 'NDK Development',
                       'Ads Kit', 'Media Kit', 'IDL', 'User Authentication Kit', 'Contacts Kit', 'Accessibility Kit',
                       'Data Protection Kit', 'Form Kit', 'ArkUI', 'IPC Kit', 'MindSpore Lite Kit', 'Localization Kit',
                       'Basic Services Kit', 'Asset Store Kit', 'Universal Keystore Kit', 'Input Kit',
                       'Multimodal Awareness Kit', 'Background Tasks Kit', 'Telephony Kit', 'Core File Kit',
                       'AVCodec Kit', 'Connectivity Kit', 'Drm Kit', 'Image Kit', 'MDM Kit', 'Network Kit',
                       'Distributed Service Kit', 'Sensor Service Kit', 'Performance Analysis Kit', 'Notification Kit',
                       'Security Guard Kit', 'Device Certificate Kit', 'Common Basic Capability',
                       'Function Flow Runtime Kit', 'ArkData', 'AVSession Kit', 'Media Library Kit', 'ArkWeb',
                       'Mechanic Kit', 'Driver Development Kit', 'Audio Kit', 'Test Kit'}
            # 功能上线时的默认值，后续没有的需要自己添加
            subsystem_set = {'MiscServices', 'XTS', 'BarrierFree', 'Common', 'DistributedSched', 'HiviewDFX',
                             'Demo&Sample', 'Base', 'Request', 'PowerManager', 'ArkCompiler', 'ResourceSchedule',
                             'Graphic', 'Resourceschedule', 'CommonLibrary', 'UserIAM', 'Test', 'Applications',
                             'FileManagement', 'ArkUI', 'DistributedHardware', 'arkcompiler', 'MultimodalInput',
                             'Global', 'Graphics', 'Notification', 'Utils', 'Ability', 'SystemManagementServices',
                             'Mechanic', 'MultimodalAwareness', 'AI', 'SelectionInput', 'Telephony', 'Window',
                             'BundleManager', 'Startup', 'Print', 'Update', 'Advertising', 'Security', 'Multimedia',
                             'DistributedDataManager', 'Msdp', 'USB', 'Communication', 'Customization', 'Account',
                             'Driver', 'WindowManager', 'Developtools', 'Web', 'Location', 'Sensors', 'Time'}

            gitcode_id_list = set()
    kit_set = set(kit_list)
    subsystem_set = set(subsystem_list)
    result["Kit"] = kit_set
    result["Subsystem"] = subsystem_set
    result["gitcode_id"] = gitcode_id_list
    print(result)
    return result